package com.solarStruggle.graphics

import java.awt.{Color, Font, GraphicsEnvironment, Point}
import javax.swing.{UIDefaults, UIManager}
import javax.swing.plaf.{FontUIResource}
import org.jvnet.substance.{SubstanceLookAndFeel}
import org.jvnet.substance.fonts.{FontPolicy, FontSet}
import org.jvnet.substance.skin.{RavenSkin}
import org.jvnet.substance.utils.{SubstanceCoreUtilities}
import org.jvnet.substance.watermark.{SubstanceImageWatermark}
import util.{Random, ResourceLoader}

class SSLookAndFeel
extends SubstanceLookAndFeel(new RavenSkin()) {
  
  def register() {
    UIManager.setLookAndFeel(this);		
  
    val sansation: Font =
  	Font.createFont(Font.PLAIN, ResourceLoader.getResource("fonts/Sansation_Regular.ttf"))
      GraphicsEnvironment.getLocalGraphicsEnvironment.registerFont(sansation)

    SubstanceLookAndFeel.setFontPolicy(SSFontPolicy)
  }
}

object SSFontPolicy
extends FontPolicy {
  
  def getFontSet(lafName: String, table: UIDefaults): FontSet =
    new FontSet {
      def getControlFont(): FontUIResource = new FontUIResource(new Font("Sansation Regular", Font.PLAIN, 12))
 
      def getMenuFont(): FontUIResource = new FontUIResource(new Font("Sansation Regular", Font.PLAIN, 12))

      def getMessageFont(): FontUIResource = new FontUIResource(new Font("Sansation Regular", Font.PLAIN, 12))

      def getSmallFont(): FontUIResource = new FontUIResource(new Font("Sansation Regular", Font.PLAIN, 12))

      def getTitleFont(): FontUIResource = new FontUIResource(new Font("Sansation Regular", Font.PLAIN, 12))

      def getWindowTitleFont(): FontUIResource = new FontUIResource(new Font("Sansation Regular", Font.PLAIN, 12))
    }
}

class StarFieldWatermark()
extends SubstanceImageWatermark("") {
  
  origImage = SubstanceCoreUtilities.createCompatibleImage(new StarrySkyGenerator(1024).createImage())
}
